<?php

class Program_content_Model extends ORM

{

	protected $table_name = 'programs_content';

	protected $primary_key = 'programs_content_id'; 

	protected $col_programs_id = 'programs_id';

	protected $col_language_id = 'languages_id';

	protected $sorting = array('programs_content_id' => 'desc');

	

	public function get($programs_id='',$language_id='')

	{

		$this->db->select('*');

		$this->db->from($this->table_name);		

		$this->db->orderby($this->primary_key,'desc');

		if($programs_id) $this->db->where($this->col_programs_id,$programs_id);

		if($language_id) $this->db->where($this->col_language_id,$language_id);

		$query = $this->db->get();

		return $query->result_array(false);

		

	}

	

	public function get_programs()

	{

		$this->db->select('*');

		$this->db->from('programs');

		$this->db->join('programs_content','programs.programs_id','programs_content.programs_id');

		$this->db->where('programs_status',1);

		$this->db->orderby('programs_sort_order','desc');	

		$this->db->orderby($this->primary_key,'desc');	

		$query = $this->db->get();

		return $query->result_array(false);

	}

}